Container Maintenance
Ansible can be used to start/stop/restart the containers. All the commands need to be executed from JavaAutolb/deploy
directory. The following commands can be used for the same.
- Database
- Start Container
sudo ansible -i inventory mysql --become --ask-become-pass -m docker_container -a "name=autolab-db state=started"
- Stop Container
sudo ansible -i inventory mysql --become --ask-become-pass -m docker_container -a "name=autolab-db state=stopped"
-
Restart Container
sudo ansible -i inventory mysql --become --ask-become-pass -m docker_container -a "name=autolab-db state=started restart=yes"
-
Gitlab
- Start Container
sudo ansible -i inventory gitlab --become --ask-become-pass -m docker_container -a "name=gitlab state=started"
- Stop Container
sudo ansible -i inventory gitlab --become --ask-become-pass -m docker_container -a "name=gitlab state=stopped"
- Restart Container
sudo ansible -i inventory gitlab --become --ask-become-pass -m docker_container -a "name=gitlab state=started restart=yes"
- Loadbalancer
- Start Container
sudo ansible -i inventory loadbalancer --become --ask-become-pass -m docker_container -a "name=loadbalancer state=started"
- Stop Container
sudo ansible -i inventory loadbalancer --become --ask-become-pass -m docker_container -a "name=loadbalancer state=stopped"
-
Restart Container
sudo ansible -i inventory loadbalancer --become --ask-become-pass -m docker_container -a "name=loadbalancer state=started restart=yes"
-
Main Server
- Start Container
sudo ansible -i inventory mainserver --become --ask-become-pass -m docker_container -a "name=mainserver state=started"
- Stop Container
sudo ansible -i inventory mainserver --become --ask-become-pass -m docker_container -a "name=mainserver state=stopped"
-
Restart Container
sudo ansible -i inventory mainserver --become --ask-become-pass -m docker_container -a "name=mainserver state=started restart=yes"
-
Execution Node
- Start Container
sudo ansible -i inventory executionnodes --become --ask-become-pass -m docker_container -a "name=execution-node-<ip>-<port> state=started"
- Stop Container
sudo ansible -i inventory executionnodes --become --ask-become-pass -m docker_container -a "name=execution-node-<ip>-<port> state=stopped"
- Restart Container
sudo ansible -i inventory executionnodes --become --ask-become-pass -m docker_container -a "name=execution-node-<ip>-<port> state=started restart=yes"
Useful Docker Commands ##
docker cp
docker inspect
docker images
docker ps
docker ps -a
docker images export and import